package com.hsy.crm.web.web.basics;

import com.hsy.crm.web.domain.cm.Response;
import com.hsy.crm.web.domain.cm.Unified;
import com.hsy.crm.web.domain.entity.CustomerType;
import com.hsy.crm.web.domain.vo.customerType.CustomerTypeSelectVo;
import com.hsy.crm.web.service.impl.CustomerTypeService;
import com.hsy.crm.web.web.BaseAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/customerType")
public class CustomerTypeAction extends BaseAction {

    @Autowired
    CustomerTypeService customerTypeService;

    @RequestMapping("/insert")
    public String insert(CustomerType customerType) {
        return Response.body(customerTypeService.insertCustomerType(customerType));
    }

    @RequestMapping("/update")
    public String update(CustomerType customerType) {
        return Response.body(customerTypeService.updateCustomerType(customerType));
    }

    @RequestMapping("/delete")
    public String delete(CustomerType customerType) {
        return Response.body(customerTypeService.deleteCustomerType(customerType));
    }

    @RequestMapping("/select")
    public String select(CustomerTypeSelectVo customerTypeSelectVo) {
        return Response.body(customerTypeService.select(customerTypeSelectVo));
    }

    @RequestMapping("/get")
    public String get(CustomerType customerType) {
        return Response.body(Unified.newInstance(customerTypeService.selectOne(customerType)));
    }

}
